package k.b.s;

import java.util.List;

import k.b.s.model.ItemRowModel;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class RSSListAdapter extends ArrayAdapter<ItemRowModel> {
	private LayoutInflater mInflater;
	private TextView mTitle;
	private TextView mDescr;
	private TextView mChannel;

	public RSSListAdapter(Context context, List<ItemRowModel> objects) {
		super(context, 0, objects);
		mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View row = convertView;

		if (convertView == null) {
			row = mInflater.inflate(R.layout.list_row, null);
		}

		ItemRowModel item = this.getItem(position);
		if (item != null) {
			String title = item.getTitle().toString();
//			String channel = item.getChannel().toString();
			mTitle = (TextView)row.findViewById(R.id.row_title);
//			mChannel = (TextView)row.findViewById(R.id.textView1);
			if(mTitle != null) {
				mTitle.setText(title);
//				mChannel.setText(channel);
			}
		}
		return row;
	}
}